#include "cGroupBox.h"

cGroupBox::cGroupBox(cHwnd * parent,int x,int y,int width,int height,string label,cHwnd * HWNDParent,ALIGNEMENT align):
                cControl(parent)
{
    HWND leParent=parent->getHwnd();
    if(HWNDParent!=NULL)
        leParent=HWNDParent->getHwnd();

    long style;
    switch(align)
    {

        case RIGHT:
            style=BS_RIGHT;
            break;

        case LEFT:
            style=BS_LEFT;
            break;


        case MIDDLE:
            style=BS_CENTER;
            break;
    };

    hWnd=CreateWindowEx(WS_EX_TRANSPARENT,"BUTTON",label.c_str(),BS_GROUPBOX| WS_CHILD | WS_VISIBLE | style ,x,y,width,height, leParent, NULL, hInstance, NULL);
    //SetWindowLong(hWnd, GWL_HWNDPARENT, leParent);
    FinalInit();

    //ctor
}

bool         cGroupBox::TraitementEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam,LRESULT & resultat)
{
    switch(message)
    {
        case WM_CTLCOLORSTATIC:
            HDC texthdc = (HDC) wparam;

            SetBkMode ( texthdc, TRANSPARENT );

			HBRUSH hbr = (HBRUSH)GetStockObject( NULL_BRUSH );
            return (LRESULT)hbr;
            break;

    };
    return false;
}

cGroupBox::~cGroupBox()
{
    //dtor
}
